name = input('请输入你的姓名：')
money = 5000


def query():
    print(f'{name},你好,你银行卡的余额为：{money}')


def savemoney(num):
    global money
    money += num
    print('---------存款-----------')
    print(f'{name},你好,你存款{num}元')
    query()


def takemoney(num):
    global money
    if money >= num:
        money -= num
    elif money < num:
        print(f'{name},您的余额不足！请重新输入取款金额')
    print('---------取款-----------')
    print(f'{name},你好,你取款{num}元')
    query()

def main():
    print('---------主菜单-----------')
    print(f'{name},你好,欢迎来到ATM取款机操作系统，请选择操作：')
    print('查询余额\t[输入1]')
    print('存款\t\t[输入2]')
    print('取款\t\t[输入3]')
    print('退出\t\t[输入4]')
    return input('请输入您的选择：')
while True:
    keybord_input=main()
    if keybord_input=='1':
        query()
        continue
    elif keybord_input=='2':
        num = float(input('请输入您的存款金额：'))
        savemoney(num)
        continue
    elif keybord_input=='3':
        num = int(input('请输入您的取款金额：'))
        takemoney(num)
        continue
    else:
        print('退出')
        break